package com.usian.admin.controller.v1;

import com.usian.admin.service.AdUserLoginService;
import com.usian.apis.admin.LoginControllerApi;
import com.usian.model.admin.dtos.AdUserDto;

import com.usian.model.common.dtos.ResponseResult;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
@RequestMapping("/login")
public class AdLoginController implements LoginControllerApi {

    @Autowired
    private AdUserLoginService adUserLoginService;

    @Override
    @PostMapping("/in")
    public ResponseResult login(@RequestBody AdUserDto adUserDto) {
        return adUserLoginService.login(adUserDto);
    }

    @GetMapping("/exprot")
    public void export(HttpServletResponse response) throws IOException {
        adUserLoginService.export(response);
    }

    @GetMapping("/import")
    public void imports(HttpServletResponse response) throws Exception{
        adUserLoginService.imports(response);
    }
}